﻿// -----------------------------------------------------------------------
// <copyright file="AddUrlForm.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Metal.CommonForms
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    /// <summary>
    /// Add url form
    /// </summary>
    public partial class AddUrlForm : Form
    {
        /// <summary>Stores the url</summary>
        private string strURL;

        /// <summary>Stores the radio name</summary>
        private string strRadioName;

        /// <summary>
        /// Initializes a new instance of the AddUrlForm class.
        /// </summary>
        public AddUrlForm()
        {
            this.InitializeComponent();
        }

        /// <summary>
        /// Gets or sets the radio url
        /// </summary>
        public string RadioURL
        {
            get
            {
                return this.strURL;
            }

            set
            {
                this.strURL = value;
            }
        }

        /// <summary>
        /// Gets or sets the radio name
        /// </summary>
        public string RadioName
        {
            get
            {
                return this.strRadioName;
            }

            set
            {
                this.strRadioName = value;
            }
        }

        /// <summary>
        /// Occurs when the user click OK
        /// </summary>
        /// <param name="sender">Object sender</param>
        /// <param name="e">Event args</param>
        private void OkButton_Click(object sender, EventArgs e)
        {
            try
            {
                // TODO: Add some validation here
                if (this.URLTextBox.Text != string.Empty && this.RadioNameTextBox.Text != string.Empty)
                {
                    this.RadioURL = this.URLTextBox.Text;
                    this.RadioName = this.RadioNameTextBox.Text;
                    this.Close();
                }
                else
                {
                    Metal.User.UserMessage.ShowInfoMessage("Please fill all required fields", "Validation error: Please fill all fields!");
                }
            }
            catch (Exception ex)
            {
                Metal.User.UserMessage.ShowError(ex);
            }
        }
    }
}
